/*
 * File:   MoveParser.cpp
 * Author: Michael Ziminsky
 *
 * Created on February 28, 2011, 6:43 PM
 */

#include "MoveParser.h"
//#include "model/Location.h"
//#include <fstream>
//#include <model/ChessBoard.h>

MoveParser::MoveParser(std::istream& in) : in(&in) {}

std::auto_ptr<ChessMove> MoveParser::getNextMove()
{
	std::string s;
	std::getline(*in, s);
	std::auto_ptr<ChessMove> m(new ChessMove(s));
	return m;
}

bool MoveParser::good()
{
	return in->good();
}

void MoveParser::swap(std::istream& in)
{
	this->in = &in;
}

/*
int main()
{
	std::ifstream f("test.txt");
	MoveParser m(f);
	model::ChessBoard b;
	while (m.good())
		m.getNextMove()->execute(b);
	f.close();
	//	m.swap(std::cin);
	//	while (m.good() && std::cin.peek() != '0')
	//		m.getNextMove()->execute(b);
	return 0;
}
*/